//package com.yunxin.core.domain.service.order.impl;
//
//import com.yunxin.common.utils.JacksonUtils;
//import com.yunxin.core.application.seceiver.message.*;
//import com.yunxin.core.utils.infra.support.rabbit.RabbitQueue;
//import com.yunxin.core.utils.infra.support.rabbit.RabbitSender;
//import lombok.RequiredArgsConstructor;
//import org.springframework.stereotype.Component;
//
//import java.math.BigDecimal;
//import java.util.Date;
//
///**
// * @author zero°
// * @since 2024-01-02
// */
//@Component
//@RequiredArgsConstructor
//public class OrderStatisticsHandle {
//
//    private final RabbitSender rabbitSender;
//
//    /**
//     * 产品统计
//     * @param productStatistics productStatistics
//     */
//    public void statisticsProductTransform(ProductStatistics productStatistics){
//        StatisticsMessage statisticsMessage = new StatisticsMessage();
//        statisticsMessage.setStatisticsTypeEnum(StatisticsTypeEnum.PRODUCT_STATISTICS);
//        productStatistics.setStatisticsDate(new Date());
//        statisticsMessage.setData(JacksonUtils.X.format(productStatistics));
//        rabbitSender.send(RabbitQueue.CoreModelQueueEnum.STATISTICS_QUEUE.getExchangeName(), RabbitQueue.CoreModelQueueEnum.STATISTICS_QUEUE.getRoutingKey(), statisticsMessage);
//    }
//
//    /**
//     * 渠道统计
//     * @param channelId channelId
//     * @param channelPromotionCode channelPromotionCode
//     * @param channelPromotionPrice channelPromotionPrice
//     * @param channelPromotionIncome channelPromotionIncome
//     * @param type type
//     */
//    public void statisticsChannelPromotionTransform(Long channelId, String channelPromotionCode, BigDecimal channelPromotionPrice, BigDecimal channelPromotionIncome, PromotionStatisticsTypeEnum type){
//        StatisticsMessage statisticsMessage = new StatisticsMessage();
//        statisticsMessage.setStatisticsTypeEnum(StatisticsTypeEnum.CHANNEL_STATISTICS);
//        ChannelPromotionStatistics channelPromotionStatistics = new ChannelPromotionStatistics();
//        channelPromotionStatistics.setChannelId(channelId);
//        channelPromotionStatistics.setChannelPromotionCode(channelPromotionCode);
//        channelPromotionStatistics.setChannelPromotionPrice(channelPromotionPrice);
//        channelPromotionStatistics.setChannelPromotionIncome(channelPromotionIncome);
//        channelPromotionStatistics.setType(type);
//        channelPromotionStatistics.setStatisticsDate(new Date());
//        statisticsMessage.setData(JacksonUtils.X.format(channelPromotionStatistics));
//        rabbitSender.send(RabbitQueue.CoreModelQueueEnum.STATISTICS_QUEUE.getExchangeName(), RabbitQueue.CoreModelQueueEnum.STATISTICS_QUEUE.getRoutingKey(), statisticsMessage);
//    }
//
//    /**
//     * 用户分配统计
//     * @param userCode userCode
//     * @param allocationDate allocationDate
//     */
//    public void statisticsUserAllocation(String userCode, Date allocationDate) {
//        StatisticsMessage statisticsMessage = new StatisticsMessage();
//        statisticsMessage.setStatisticsTypeEnum(StatisticsTypeEnum.USER_ALLOCATION_STATISTICS);
//        UserAllocationStatistics userAllocationStatistics = new UserAllocationStatistics();
//        userAllocationStatistics.setUserCode(userCode);
//        userAllocationStatistics.setAllocationDate(allocationDate);
//        statisticsMessage.setData(JacksonUtils.X.format(userAllocationStatistics));
//        rabbitSender.send(RabbitQueue.CoreModelQueueEnum.STATISTICS_QUEUE.getExchangeName(), RabbitQueue.CoreModelQueueEnum.STATISTICS_QUEUE.getRoutingKey(), statisticsMessage);
//    }
//}
